## 配置docker环境
# 删除原先的相关环境
yum remove docker docker-client  docker-client-latest  docker-common  docker-latest  docker-latest-logrotate  docker-logrotate docker-engine
# 下载必要软件
yum install -y yum-utils
# 镜像配置
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 更新软件包索引
yum makecache fast
# 下载docker
yum install docker-ce docker-ce-cli containerd.io
# 启动docker
systemctl start docker
# 阿里云镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
 "registry-mirrors": ["https://wf09nu9h.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 下载docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# 赋予docker-compose以执行权限
cd /usr/local/bin/
chmod +x docker-compose
# 创建mysql的相关外部环境
mkdir -p /mydata/mysql/data
mkdir -p /mydata/mysql/log
mkdir -p /mydata/mysql/conf
# 挂在数据卷
docker volume create --name mydata

cp /root/my.cnf /mydata/mysql/conf

## 配置nginx环境
# docker run -p 80:80 --name nginx -v /mydata/nginx/html:/usr/share/nginx/html -v /mydata/nginx/logs:/var/log/nginx -d nginx:1.10
# docker container cp nginx:/etc/nginx /mydata/nginx/
# mv /mydata/nginx/nginx /mydata/nginx/conf
# docker stop nginx
# docker rm nginx

## 配置redis环境
cd /mydata
mkdir redis
cd /mydata/redis
mkdir data
cp /root/redis.conf /mydata/redis/


